package pms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import pms.dao.RennlaeuferDao;


/** 
 * Controller to generate the Home Page basics to be rendered by a view. 
 * It extends the convenience class AbstractController that encapsulates most 
 * of the drudgery involved in handling HTTP requests. 
 * 
 * This class is a super type of SaveRennlaeufer and LoescheRennlaeufer. If is used as a next view
 * after successfully executing those controllers.
 * @author josef@dr-schneeberger.de
 */
public class AlleRennlaeufer extends AbstractController {
	//private static Log log = LogFactory.getLog(AlleRennlaeufer.class); //new
	private RennlaeuferDao rennlaeuferDao;
	
	
	public void setRennlaeuferDao(RennlaeuferDao rennlaeuferDao) {
		this.rennlaeuferDao = rennlaeuferDao;
	}

	public RennlaeuferDao getRennlaeuferDao() {
		return rennlaeuferDao;
	}

	protected ModelAndView handleRequestInternal(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		//log.info(httpServletRequest.getPathTranslated()); //new
		ModelAndView mv = new ModelAndView();
		mv.addObject("title", "Vereinsmitglieder");
		mv.addObject("message", "Alle Mitglieder des Vereins");
		mv.addObject("rennlaeufer", rennlaeuferDao.findAll());
		mv.setViewName("list-rennlaeufer");
		return mv;
	}
}
